﻿using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Web;
using YiSha.Business;
using YiSha.Business.Cache;
using YiSha.Service;

namespace YiSha.Admin.Web;

public class Program
{
    public static void Main(string[] args)
    {
        var builder = WebApplication.CreateBuilder(args);
        builder.Services.AddBusiness();
        builder.Services.AddService();
        builder.Services.AddBusinessCache();
        var startup = new Startup(builder.Configuration, builder.Environment);

        startup.ConfigureServices(builder.Services);
        builder.Host.UseNLog().ConfigureLogging(logging =>
        {
            logging.ClearProviders();
            logging.SetMinimumLevel(LogLevel.Trace);
        });
        var app = builder.Build();
        startup.Configure(app, app.Environment);
        app.Run();
    }
}